package com.tj.collection.utils;

import com.fqgj.common.utils.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: pavan
 * Date: 2020/1/13
 * Time: 下午9:01
 */
public class ChannelUtil {

    public static String convertChannel(String displayChannel) {
        String newChannel = displayChannel;
        String tmp = displayChannel.toLowerCase();
        if (tmp.contains("meetsocial")) {
            newChannel = "Meetsocial";
        } else if (tmp.contains("sojoy")) {
            newChannel = "sojoy";
        } else if (tmp.contains("miqtech")) {
            newChannel = "miqtech";
        } else if (tmp.contains("mobvista")) {
            newChannel = "Mobvista";
        } else if (tmp.contains("lendingadda")) {
            newChannel = "lendingadda";
        } else if (tmp.contains("firemobo")) {
            newChannel = "firemobo";
        } else if (tmp.contains("epoch")) {
            newChannel = "epoch";
        } else if (tmp.contains("himobi")) {
            newChannel = "himobi";
        } else if (tmp.contains("fbmagictt")) {
            newChannel = "fbmagictt";
        } else if (tmp.contains("facebook")) {
            newChannel = "Facebook";
        } else if (tmp.contains("organic")) {
            newChannel = "Organic";
        }
        return newChannel;
    }

    private static List<String> promotionChannels = null;

    public static List<String> getPromotionChannels() {
        if (promotionChannels != null) {
            return promotionChannels;
        }
        List<String> channels = new ArrayList<>();
        channels.add("meetsocial");
        channels.add("sojoy");
        channels.add("miqtech");
        channels.add("mobvista");
        channels.add("lendingadda");
        channels.add("firemobo");
        channels.add("epoch");
        channels.add("himobi");
        channels.add("fbmagictt");
        promotionChannels = channels;
        return channels;
    }

    private static List<String> ddPromotionChannels = null;

    public static List<String> getDhanaDhanPromotionChannels() {
        if (ddPromotionChannels != null) {
            return ddPromotionChannels;
        }
        List<String> channels = new ArrayList<>();
        channels.add("mobvista");
        channels.add("hamobi");
        ddPromotionChannels = channels;
        return channels;
    }

    public static boolean isDhanaDhanPromotionChannels(String channel) {
        if (StringUtils.isEmpty(channel)) {
            return false;
        }
        String channelLow = channel.toLowerCase();
        if (channelLow.contains("mobvista")
                || channelLow.contains("hamobi")) {
            return true;
        }
        return false;
    }

}
